﻿{extend name="public:base" /}

{block name="content"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">
                <div class="ibox-content">
                    <div class="row search-form">
                        <div class="col-sm-2 m-b-sm">
                            <div class="input-group">
                                <input placeholder="请输入姓名" name="username" value="{:input('username')}" type="text" class="form-control form-control-lg">
                            </div>
                        </div>
                        <div class="col-sm-2 m-b-sm">
                            <div class="input-group">
                                <input placeholder="请输入手机号" name="mobile" value="{:input('mobile')}" type="text" class="form-control form-control-lg">
                            </div>
                        </div>
                        <div class="col-sm-2 m-b-sm">
                            <div class="input-group">
                                <select name="examine_status" class="form-control-sm form-control input-s-sm inline">
                                    <option value="-1" {:input(
                                    'examine_status') == -1 ? 'selected' : ''}>请选择</option>
                                    <option value="0" {:input(
                                    'examine_status') === '0' ? 'selected' : ''}>未审核</option>
                                    <option value="1" {:input(
                                    'examine_status') == 1 ? 'selected' : ''}>已审核</option>
                                    <option value="2" {:input(
                                    'examine_status') == 2 ? 'selected' : ''}>审核驳回</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-sm-2 m-b-sm">
                            <div class="input-group">
                                <button type="button" class="btn btn-primary btn-lg screen-btn">搜索</button>
                            </div>
                        </div>
                    </div>

                    <div class="hr-line-dashed"></div>
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <tr>
                                <th>ID</th>
                                <th>姓名</th>
                                <th>手机号</th>
                                <th>职业</th>
                                <th>微信号</th>
                                <th>省-市</th>
                                <th>身份证</th>
                                <th>审核状态</th>
                                <th>申请时间</th>
                                <th>操作</th>
                            </tr>
                            {volist name="list" id="vo"}
                            <tr>
                                <td>{$vo.id}</td>
                                <td>{$vo.username}</td>
                                <td>{$vo.mobile}</td>
                                <td>{$vo.work}</td>
                                <td>{$vo.wx}</td>
                                <td>{$vo.province_name}-{$vo.city_name}</td>
                                <td>
                                    <img src="{$vo.card_z|getPicture}" style="width: 150px;height: 100px; object-fit: cover;"/>
                                    <br>
                                    <br>
                                    <img src="{$vo.card_f|getPicture}" style="width: 150px;height: 100px; object-fit: cover;"/>
                                </td>
                                <td>{:doExamineStatus($vo.examine_status)}</td>
                                <td>{:timeFormat($vo.create_time)}</td>
                                <td>
                                    {if $vo.examine_status == 0}
                                    <a href="{:url(doExtendStatus, ['id' => $vo.id])}" class="btn btn-white btn-sm ajax-operate"><i class="iconfont icon-renzhengyonghu"></i> 审核通过
                                    </a>
                                    <a class="btn btn-white btn-sm" onclick="refuse({$vo.id})"><i class="iconfont icon-close"></i> 审核驳回
                                    </a>
                                    {/if}
                                </td>
                            </tr>
                            {/volist}
                        </table>
                        {if !empty($list)}{$list->render()}{/if}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>{/block}

{block name="js"}
<script>
    function refuse(id) {
        layer.prompt({title: '驳回原因', formType: 2}, function (refuse_reason, index) {
            layer.close(index);
            $.post('/admin/manage/doExtendStatus', {id, refuse_reason, examine_status: 2}, res => {
                if (res.result == 1) {
                    layer.msg(res.msg, {icon: 1, time: 1000}, () => {
                        location.reload()
                    });
                } else {
                    layer.msg(res.msg, {icon: 2, time: 1000});
                }
            }, 'json')
        });
    }
</script>{/block}